const extractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
    rules:[
        {
            test:/\.vue$/,
            use:{
                loader:'vue-loader'
            },
            exclude:/node_modules/
        },
        {
            test:/\.(jsx|js)$/,
            use:{
                loader:'babel-loader'
            },
            exclude:/node_modules/
        },
        {
            test:/\.css$/,
            use: extractTextPlugin.extract({
                fallback: "style-loader",
                use: [{
                    loader:"css-loader"
                },{
                    loader:"postcss-loader"
                }]
            })
        },
        {
            test:/\.(png|jpg|gif)/ ,
            use:[{
                loader:'url-loader',
                options:{
                    limit:500000,
                    outputPath:'images/'
                }
            }]
        },
        {
            test: /\.(htm|html)$/i,
            use:[ 'html-withimg-loader']
        },
        {
            test: /\.less$/,
            use: extractTextPlugin.extract({
                fallback: 'style-loader',
                use: [
                    { loader: 'css-loader', options: { importLoaders: 1 } },
                    'less-loader',
                    'postcss-loader'
                ]
            })
        }
    ]
};